<template>
  <div>
    <h1>{{count}}</h1>
    <button @click="add">点击</button>
  </div>
</template>

<script>
import PubSub from 'pubsub-js'
export default {
  name: "Didi",
  data() {
    return {
      count: 1,
    };
  },
  methods:{
      add(){
          this.count++
          PubSub.publish("count",this.count)
      }
  }
};
</script>

<style>
</style>